#include <stdio.h>
#include <stdlib.h>
#include "Structs.h"
#include "Pong3D.h"
#include "glfont.h"
#include <GL/glut.h>
#include <math.h>
#include <Windows.h>
#include "glm.h"

GLMmodel* pmodel = NULL;
GLMmodel* pPaddleModel = NULL;
GLMmodel* pSkull = NULL;

void drawTrophy(){
	GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
	GLfloat mat_shininess[] = { 30.0 };
	glEnable(GL_COLOR_MATERIAL);
	glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);
	glShadeModel (GL_SMOOTH);
	glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
	glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);

    if (!pmodel) {
        pmodel = glmReadOBJ("models/trophy.obj");
		
        if (!pmodel) exit(0);
        glmUnitize(pmodel);
        glmFacetNormals(pmodel);
        glmVertexNormals(pmodel, 90.0);
    }
    glColor3f(1, 0.83, 0);
    glmDraw(pmodel, GLM_SMOOTH | GLM_MATERIAL);
}


void drawSkull(){
    if (!pSkull) {
        pSkull = glmReadOBJ("models/skull.obj");
        if (!pSkull) exit(0);
        glmUnitize(pSkull);
        glmFacetNormals(pSkull);
        glmVertexNormals(pSkull, 90.0);
    }
    
    glmDraw(pSkull, GLM_SMOOTH | GLM_MATERIAL);
}


void drawVictoryPaddle(){
    if (!pPaddleModel) {
        pPaddleModel = glmReadOBJ("models/pingpong.obj");
        if (!pPaddleModel) exit(0);
        glmUnitize(pPaddleModel);
        glmFacetNormals(pPaddleModel);
        glmVertexNormals(pPaddleModel, 90.0);
    }
    
    glmDraw(pPaddleModel, GLM_SMOOTH | GLM_MATERIAL);
}